﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web;
using System.Web.Mvc;


namespace Model
{

    [MetadataType(typeof(BuyStock_Metadata))]
    [DisplayName("进货单")]
    public partial class BuyStock
    {
        public BuyStock()
        {
            this.Id = Guid.NewGuid();
            this.UserId = new Guid(HttpContext.Current.User.Identity.Name);
            this.BuyId = "JHD-" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
            this.AddDate = DateTime.Now;
        }

        public class BuyStock_Metadata
        {
            [ScaffoldColumn(false)]
            public Guid Id { get; set; }

            [ScaffoldColumn(false)]
            public Guid UserId { get; set; }

          
            [DisplayName("进货单编号")]
            [DisplayFormat(ConvertEmptyStringToNull=false)]
            public object BuyId { get; set; }


            [DisplayName("供应商")]
            [DropDownList("Supplier", "Id", "SupplierName")]
            public object SupplierId { get; set; }

            [DisplayName("产品名称")]
            [Required(ErrorMessage = "产品名称不能为空")]
            public object ProductName { get; set; }

            [DisplayName("产品编码")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object ProductCode { get; set; }

            [DisplayName("产品分类")]
            [DropDownList("ProductCatalog", "Id", "CatalogName")]
            public object CatalogId { get; set; }



            [DisplayName("采购数量")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            [Required(ErrorMessage = "采购数量不能为空")]
            public object Unit { get; set; }

            [DisplayName("采购单价")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object CostPrice { get; set; }

            [DisplayName("采购总价")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]          
            public object TotalPrice { get; set; }

            [DisplayName("描述信息")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            [DataType(DataType.MultilineText)]
            public object Description { get; set; }

            [DisplayName("添加日期")]
            [ScaffoldColumn(false)]
            [DataType(DataType.DateTime)]
            public object AddDate { get; set; }


        }
    }
}
